package com.jevons.geo_edit.event;

import com.jevons.geo_edit.model.GisLayer;

import java.util.HashMap;
import java.util.Map;


/**
 * Copyright 2020 JxGIS
 *
 * @file GisMapLayerOpEvent
 * @auth linaisheng
 * Created on 2023/6/13.
 * Description：
 */
public class GisMapLayerOpEvent {

    public static final String EVENT_CREATE_LAYER = "createLayer";

    public static final String EVENT_SELECTED_LAYER = "selectedLayer";

    public static final String EVENT_SHOW_LAYER_SETTING = "showLayerSetting";

    public static final String EVENT_SHOW_LAYER_FIELD_LIST = "showLayerFieldList";

    public static final String EVENT_SHOW_LAYER_GEOMETRY_LIST = "showLayerGeometryList";

    public static final String EVENT_NOTIFY_LAYER_VISIBLE = "notifyLayerVisible";
    public static final String EVENT_NOTIFY_LAYER_INVISIBLE = "notifyLayerInvisible";

    public static final String EVENT_NOTIFY_LAYER_STYLE_CHANGE = "notifyLayerStyleChange";

    public static final String EVENT_NOTIFY_LAYER_SORT_CHANGE = "notifyLayerSortChange";

    public static final String EVENT_NOTIFY_LAYER_REMOVE = "notifyLayerRemove";


    private String eventFlag;
    private String layerId;
    private GisLayer gisLayer;

    private Map<String, String> data = new HashMap<>();

    public GisMapLayerOpEvent(String eventFlag, GisLayer gisLayer) {
        this.eventFlag = eventFlag;
        this.gisLayer = gisLayer;
        if (gisLayer != null) {
            this.layerId = gisLayer.getId();
        }
    }

    public String getEventFlag() {
        return eventFlag;
    }

    public String getLayerId() {
        return layerId;
    }

    public GisLayer getGisLayer() {
        return gisLayer;
    }

    public String getData(String key) {
        if (data.containsKey(key)) {
            return data.get(key);
        }
        return null;
    }

    public void addData(String key, String value) {
        data.put(key, value);
    }



}